package com.andox.fn.inf.rpc.rest.example;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface UserService {
	User addUser (User user);
	List<User> list();
	void doNotExport();
	
	public static enum UserType{
		VIP, COMMON,
	}
	
	
	
	public static class User {
		private UserType userType;
		private Integer id;
		private String name;
		private Integer age;
		private Map<String, Object> properties;

		public static User newInstance(String name, Integer age, UserType userType) {
			User u = new User();
			u.setAge(age);
			u.setName(name);
			u.setUserType(userType);
			return u;
		}
		public User addProperty(String k, Object v) {
			if (this.properties == null)
				this.properties = new HashMap<String, Object>();
			
			this.properties.put(k, v);
			return this;
		}
		
		public Integer getId() {
			return id;
		}
		public void setId(Integer id) {
			this.id = id;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public Integer getAge() {
			return age;
		}
		public void setAge(Integer age) {
			this.age = age;
		}
		public UserType getUserType() {
			return userType;
		}
		public void setUserType(UserType userType) {
			this.userType = userType;
		}
		public Map<String, Object> getProperties() {
			return properties;
		}
		public void setProperties(Map<String, Object> properties) {
			this.properties = properties;
		}
	}
}
